# num = []
import datetime
# i = 2
# for i in range(2, 152):
#     j = 2
#     for j in range(2, i):
#         if i % j == 0:
#             break
#     else:
#         num.append(i)
# print(num)

# list = [1,2,3,4,5,6,7,8,9,10]
# list.extend([11,'sb'])
# list.remove(17)
# list.pop(2)
# list.reverse()
# list=list.copy()
# list.clear()

# print(list)
# tup = (1,2,3,4,5,6,7,(22,6))
# print(tup,type(tup))
# print(tup.count(6))
# print(tup[7])
# print(tup*2)
# dict = {}
# set = {1,20}
# set.add(100
# print(set)
# money = 50
# che = []
# good = []
# price = []
# list = []
# for i in range(1, 101):
#     if i % 2 == 0:
#         list.append(i)
# print(list)
list2 = []
# for i in list:
#     list2.append(i**2)
# # print(list2)
# # filter = filter(lambda k: k<=1000,list2)
# # list3 = list(filter)
# list3=[i for i in list2 if i <= 1000]
# # for i in list2:
#     if i <= 1000:
#         list3.append(i)
# # print(list3)
# list3.reverse()
# # print(list3)
# # print(list3[:10])
# list3.extend([101,102,103])
# avg = sum(list3)/len(list3)
# list3.sort()
# max = list3[-1]
# min = list3[0]
# print(list3.index(11))
# print(avg,max,min)
# print(list3)
# print(list(map(str,list3)))
# list4 = []
# for i in list3:
#     q='%3f'%i
#     list4.append(q)
# print(list4)
# print(list3)
# print(len(i >50 for i in list3))
# print(len([i for i in list3 if i>50])
# list3.insert(2,99)
# list3.pop()
# # print(list3)
# list4=[]
# for i in list3:
#     a = i*2
#     list4.append(a)
# print(list4)
# list4 = [x*2 for x in list3]
# print(list4)
# list4 = [x for x in list3 if x > 50]
# list5 = [x for x in list3 if x < 50]
# print(list4)
# print(list5)
# dict = {index:zhi for index,zhi in enumerate(list3)}
# print(dict)
# for i,zhi in enumerate(list3):
#     print(i,zhi)
# import random
# print(random.choice(list3))
# with open()
import random
money = 50000
goods = [('牙刷', 1000), ('ipple', 500), ('bosh', 200), ('范小勤', 10000), ('阳弟', 1), ('黄虫', 0)]
print('\n编号','商品','价格')
for i,(j, k) in enumerate(goods):
    print(i+1, j, k)
print('0 退出')
che = []
while True:
    n = int(input('请输入想要购买的商品的编号:'))
    if n == 0:
        break
    if n > len(goods):
        print('没有这个商品，别瞎弄！')
        continue
    che.append(goods[n-1])
    print('已添加购物车')
    c = int(input('您还要添加嘛？请输入：1/继续 0/退出 2/退还刚才选中的商品'))
    if c == 0:
        break
    elif c == 2:
        che.remove(goods[n-1])
        print('已移除购物车')
    else:
        continue

dict = dict(che)
che1 = list(dict.keys())
print('当前购物车有：{}'.format(che1))

sum = sum(dict.values())
if sum <= money:
        money = money - sum
        print('恭喜，购买成功！！商品花了{}元，您的卡余额还剩{}元'.format(sum, money))
else:
        print('穷鬼，钱不够！请到其他超市购买！')
print("打印购物小条：{}，商品个数{}，购买时间：{}，总价为：{}".format(dict,len(che),datetime.datetime.now().strftime('%Y-%m-%d  %H:%M:%S'),sum))